package com.listpopulation;

import java.io.File;



public class ListFilesInDirectory {
	
	private static final String[] FILE_TYPES = {".avi", ".mp4"};

	public static void main(String[] args) {
		
		String directoryPath = "C:/Users/Stoleto/Downloads";
		
		listDirectory(directoryPath);

	}
	
	public static void listDirectory(String directoryPath) {
        // List all the directory contents
        for (String contents: new File(directoryPath).list()) {
             
            // Directory path for files and directories
            contents = directoryPath+"/"+contents;
             
            // Display full path names
            for(int i=0 ; i < FILE_TYPES.length-1; i++){
            	if(contents.endsWith(FILE_TYPES[i])){
            		System.out.println(contents);
            		continue;
            	}
            }
            
            // For directories go recursively down
            if (new File(contents).isDirectory()) {
                 
                // Go down to next directory
                listDirectory(contents);
            }
        }
    }

}
